<?php

namespace WeForge\Runtime;

class StorageDirectories
{
    /**
     * The storage path for the execution environment.
     *
     * @return string
     */
    public static function path()
    {
        return '/tmp/storage';
    }

    /**
     * Ensure the necessary storage directories exist.
     *
     * @return void
     */
    public static function create()
    {
        $directories = [
            static::path().'/app',
            static::path().'/bootstrap/cache',
            static::path().'/framework/cache',
            static::path().'/framework/sessions',
            static::path().'/framework/views',
        ];

        foreach ($directories as $directory) {
            if (! is_dir($directory)) {
                mkdir($directory, 0755, true);
            }
        }
    }
}
